package com.atguigu.tingshu.user.api;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.user.VipServiceConfig;
import com.atguigu.tingshu.user.service.VipServiceConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "VIP服务配置管理接口")
@RestController
@RequestMapping("api/user/vipServiceConfig")
@SuppressWarnings({"all"})
public class VipServiceConfigApiController {

	@Autowired
	private VipServiceConfigService vipServiceConfigService;

	@Operation(summary = "显示开通vip期限")
	@GetMapping("/findAll")
	public Result findAll(){
		List<VipServiceConfig> list = vipServiceConfigService.list();
		return Result.ok(list);
	}

	//根据id获取vip信息
	@Operation(summary = "根据id获取vip信息")
	@GetMapping("/getVipServiceConfig/{itemId}")
	public  Result<VipServiceConfig> getVipServiceConfig(@PathVariable("itemId") Long itemId){
		VipServiceConfig vipServiceConfig = vipServiceConfigService.getById(itemId);
	return Result.ok(vipServiceConfig);

	}

}

